<admintpl file="header" />
<link rel="stylesheet" href="__PUBLIC__/css/simple_upload.css" type="text/css" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Admin/Live/index')}">直播列表</a></li>
			<li><a href="{:U('Admin/Live/add_competition')}">添加赛事直播</a></li>
			<li><a href="{:U('Admin/Live/add_activity')}">添加活动直播</a></li>
			<li class="active"><a>查看活动直播</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" enctype="multipart/form-data" action="{:U('Admin/Live/edit_activity_post')}">
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">直播名称：</label>
					<div class="span3">
						<input type="text" name="name" disabled value="{$name}">
					</div>
					<label class="span1 control-label" style="width: 90px;">是否VR：</label>
					<div class="span3">
						<select class="select_2" disabled name="category">
							<option value="1" <if condition="$category eq 1"> checked </if>>否</option>
							<option value="2" <if condition="$category eq 2"> checked </if>>是</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">开始时间：</label>
					<div class="span3">
						<input type="text" name="startTime" disabled value="{$startTime/1000|date='Y-m-d H:i', ###}" class="js-datetime" autocomplete="off">
					</div>
					<label class="span1 control-label" style="width: 90px;">结束时间：</label>
					<div class="span3">
						<input type="text" class="js-datetime" disabled value="{$endTime/1000|date='Y-m-d H:i', ###}" name="endTime" autocomplete="off">
					</div>
				</div>
				<div class="control-group">
				    <label class="span1 control-label" style="width: 90px;">设备类型：</label>
					<div class="span3">
						<select class="select_2" disabled id="deviceType" name="deviceType">
							<option value="1" <if condition="$deviceType eq 1"> checked </if>>摄像机</option>
							<option value="2" <if condition="$deviceType eq 2"> checked </if>>手机</option>
						</select>
					</div>
					<label class="span1 control-label" id="liveOperatorIdLabel" style="width: 90px;">直播员：</label>
					<div class="span3">
						<select class="select_2" id="liveOperatorId" disabled name="liveOperatorId">
							<foreach name="operatorList" item="vo">
								<option value="{$vo.operatorId}" >{$vo.onickName}({$vo.ouserName})</option>
							</foreach>
						</select>
					</div>
				</div>
				
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">直播频道：</label>
					<div class="span3">
					    <table class="table table-hover table-bordered">
							<tbody>
							<foreach name="selectedChannels" item="vo">
							    <tr>
							    <td>{$vo.channelName}</td>
							    <td><a class="link_url" data-clipboard-text="{$vo.pushUrl}" title="{$vo.pushUrl}" href="javascript:;">复制推流地址</a></td>
								</tr>
							</foreach>
							</tbody>
		               </table>
					</div>
					<label class="span1 control-label" style="width: 90px;">解说员：</label>
					<div class="span3">
						<input type="hidden" name="operatorIds" id="operatorIds"/>
						<select multiple="multiple" id="selectedOperatorIds" style="height:150px;">
							<foreach name="selectedCommentators" item="vo">
								<option value="{$vo}" >{$vo}</option>
							</foreach>
						</select>
					</div>
				</div>
				
				<div class="control-group" style="display:none;">
					<label class="span1 control-label" style="width: 90px;">解说员：</label>
					<div class="span3">
						<select multiple="multiple" id="allOperatorIds" style="height:120px;">
						    <foreach name="operatorList" item="vo">
								<option value="{$vo.operatorId}" >{$vo.onickName}({$vo.ouserName})</option>
							</foreach>
						</select>
					</div>
					<label class="span1 control-label" style="width: 90px;text-align:center;margin-top:36px;">></label>
					<div class="span3">
						
					</div>
				</div>
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">活动介绍：</label>
					<div class="span7">
						<textarea style="width: 556px; height: 60px;" disabled name="introduction">{$introduction}</textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">封面图片：</label>
					<div class="span3 wrapper">
                          <div id="uploader-image">
                              <div id="fileList" class="uploader-list">
                                  <div id="imageDiv" class="file-item thumbnail" style="width:150px;height: 150px;">
                                      <a href="{$imageUrl}" title="查看原图" target="_blank"><img id="imagePreview" src="{$imageUrl}" style="width:150px;height: 150px;"></a>
                                  </div>
                              </div>
                          </div>
                    </div>
                    
				</div>
			<div class="form-actions" style="padding-left:260px;">
			    <input type="hidden" name="broadcastId" value="{$broadcastId}"/>
			    <if condition="$status eq 1">
			        <a class="btn btn-primary" href='{:U("Admin/Live/edit", array("broadcastId"=>number_format($broadcastId, 0, "", "")))}'>编辑</a>
				</if>
				
				&nbsp;&nbsp;<a class="btn" href="{:U('Admin/Live/index')}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js"></script>
	<script type="text/javascript" >
		
		function setOperatorIds(){
			var ids = [];
			$('#selectedOperatorIds option').each(function(){
				ids.push($(this).val());
			});
			$('#operatorIds').val(ids.join(','));
		}
		
		$('#deviceType').change(function(){
			if($('#deviceType').val() == 1){
				$('#liveOperatorId').attr('disabled', true);
				$('#liveOperatorId').css('display', 'none');
				$('#liveOperatorIdLabel').css('display', 'none');
			}else{
				$('#liveOperatorId').attr('disabled', false);
				if($('#selectedChannelIds option').length > 1){
					$('#allChannelIds').append($('#selectedChannelIds').html());
					$('#selectedChannelIds').html('');
					setChannelIds();
				}
			}
		});
		
		$('#deviceType').val({$deviceType});
		$('#deviceType').change();
		$('#liveOperatorId').val({$liveOperatorId});
		$("#selectedChannelIds option").each(function(){
			$('#allChannelIds option[value="'+$(this).val()+'"]').remove();
		});
		
		$("#selectedOperatorIds option").each(function(){
			$(this).text($('#allOperatorIds option[value="'+$(this).val()+'"]').text());
			$('#allOperatorIds option[value="'+$(this).val()+'"]').remove();
		});
		
		setOperatorIds();
		$(document).ready(function(){
			$('input[name="query_form_btn"]').click(function(){
				 $('#query_form').attr('action', $(this).attr('data-action'));
				 $('#query_form').submit();
			});
			var clip = new ZeroClipboard($("td .link_url"));
			clip.on("aftercopy", function(e){
			    alert('复制成功！');
			});
		});
	</script>
</body>
</html>